﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Text;
using System.Web.UI;
using AnyOffice.DAL;
using AnyOffice.Components;
using AnyOffice.Model;

namespace AnyOffice.general.status_bar
{
    public partial class sms_submit : BasePage
    {

      
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = (Request.QueryString["sms_id"] != null) ? Request.QueryString["sms_id"].ToString() : "0";
            string str2 = (Request.QueryString["del"] != null) ? Request.QueryString["del"].ToString() : "0";
            string str3 = (Request.QueryString["to_id"] != null) ? Request.QueryString["to_id"].ToString() : "";
            string str4 = (Request.QueryString["to_name"] != null) ? Request.QueryString["to_name"].ToString() : "";
            SmsDao dao = new SmsDao();
            StringBuilder builder = new StringBuilder();
            builder.Append("<script Language=\"JavaScript\">");
            builder.Append("self.close();");
            builder.Append("</script>");
            if (Convert.ToInt32(str2) == 0)
            {
                dao.CancelRemind(base.Conn, Convert.ToInt32(str), base.User.Identity.Name);
                base.CloseConn();
                if ((str3 != string.Empty) & (str4 != string.Empty))
                {
                    Response.Redirect("sms_back.aspx?to_id=" + str3 + "&to_name=" + str4);
                }
                else
                {
                    this.Page.RegisterClientScriptBlock("PopClose", builder.ToString());
                }
            }
            else
            {
                dao.Delete(base.Conn, Convert.ToInt32(str), base.User.Identity.Name);
                this.Page.RegisterClientScriptBlock("PopClose", builder.ToString());
            }
        }
 

    }
}
